#!/bin/bash

echo "🌱 智慧农业边缘控制系统启动脚本"
echo "=================================="

# 检查Python环境
if command -v python3 &> /dev/null; then
    echo "✅ Python3 已安装"
else
    echo "❌ 请先安装Python3"
    exit 1
fi

# 检查依赖包
echo "📋 检查依赖包..."
python3 -c "import matplotlib, numpy, flask" 2>/dev/null
if [ $? -eq 0 ]; then
    echo "✅ 依赖包检查完成"
else
    echo "⚠️  正在安装依赖包..."
    pip3 install matplotlib numpy flask
fi

echo ""
echo "🚀 选择启动模式:"
echo "1) 修复版GUI (推荐, 解决字体问题)"
echo "2) 修复版Web (推荐, 自动选择端口)"  
echo "3) 简化启动器 (新用户推荐)"
echo "4) 原版GUI (可能有字体警告)"
echo "5) 原版Web (可能有端口冲突)"

read -p "请选择 (1-5): " choice

case $choice in
    1)
        echo "🖥️  启动修复版GUI..."
        python3 fixed_main.py
        ;;
    2)
        echo "🌐 启动修复版Web..."
        python3 fixed_web.py
        ;;
    3)
        echo "🔧 启动简化启动器..."
        python3 simple_start.py
        ;;
    4)
        echo "🖥️  启动原版GUI..."
        python3 main.py
        ;;
    5)
        echo "🌐 启动原版Web..."
        echo "请在浏览器中访问: http://localhost:5000"
        python3 web_demo.py
        ;;
    *)
        echo "❌ 无效选择，启动简化启动器..."
        python3 simple_start.py
        ;;
esac